package com.yurun.controller.admin;

import com.yurun.entity.BCategory;
import com.yurun.model.vo.Result;
import com.yurun.service.BCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin")
public class BCategoryAdminController {
    @Autowired
    BCategoryService bCategoryService;
    /**
     * @Description: 后台-添加业务分类
     * @Param: bCategory
     * @return: void
     * @Author: JimmyYao
     * @Date: 2022/2/9
     */
    @PostMapping("/bcategory")
    public void addBCategory(@RequestBody BCategory bCategory){
        bCategoryService.addBcategory(bCategory);
    }
    /**
     * @Description: 后台-通过ID-删除业务分类
     * @Param: id
     * @return: void
     * @Author: JimmyYao
     * @Date: 2022/2/9
     */
    @DeleteMapping("/bcategory/id")
    public void deleteBcategoryById(@RequestParam Long id){
        bCategoryService.deleteBcategoryById(id);
    }
    /**
     * @Description: 后台-获取业务分类列表
     * @Param:
     * @return: com.yurun.model.vo.Result
     * @Author: JimmyYao
     * @Date: 2022/2/9
     */
    @GetMapping("/bcategorylist")
    public Result getBCategoryList(){
        List<BCategory> object=bCategoryService.getBCategoryList();
        return Result.ok("获取业务类型列表成功",object);
    }
}
